/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Ltd.            */
/*                                                                 */
/*  NAME      = t_slqserver_create_request.c                       */
/*  NOTE      =                                                    */
/*  DATE      = 2014/12/08 by geyh                                 */
/*******************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <CUnit/Basic.h>

#include <frcomm.h>
#include <sqlserver/config.h>
#include <sqlserver/sqlserver_core.h>
#include <sqlserver/sqlserver_common.h>

static int __suite_init(void)
{

    return 0;
}

static int __suite_cleanup(void)
{

    return 0;
}

static void __case1(void)
{
    uint8_t u8_packet_type = 0;
    L7_req_sqlserver *p_st_req = NULL;

    p_st_req = slqserver_create_request(u8_packet_type);

    CU_ASSERT_EQUAL(p_st_req->u8_request_type, 0);
    CU_ASSERT_EQUAL(p_st_req->u8_packet_type, 0);
    CU_ASSERT_EQUAL(p_st_req->i_need_req_resp, MSSQL_REQUEST);

    sqlserver_destroy_request(&p_st_req);

    return;
}

int add_suite_slqserver_create_request(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" slqserver_create_request()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    //增加测试用例
    if (CU_add_test(pSuite, "case1", __case1) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
